#include <iostream>
#include <BinaryTree.hpp>

using namespace std;

class Solution
{
public:
    bool hasPathSum(TreeNode *root, int targetSum)
    {
        if (root == nullptr)
        {
            return false;
        }
        return (root->left != nullptr && hasPathSum(root->left, targetSum - root->val)) || (root->right != nullptr && hasPathSum(root->right, targetSum - root->val)) || (root->left == nullptr && root->right == nullptr && root->val == targetSum);
    }
};

int main()
{
    cout << "Code112" << endl;
    Solution s;
    return 0;
}